package com.youtills.core.lang;

/**
 * TODO - !!!doc me!!!
 *
 * @author ravi.chiluveru
 * @since 23.0 (9/30/14)
 */
public final class NumberUtil {

    private NumberUtil() {
    }

    public static boolean firstGreaterThanAll(Number... numbers){

        if (numbers != null && numbers.length > 1){
            Number first = numbers[0];

            for(int i = 1; i < numbers.length; i++ ) {
                Number number = numbers [i];
                if(number != null) {

                }
            }

        }

        return true;
    }

    public static boolean isGreaterThanZero(Number number) {
        return (number != null && number.doubleValue() > 0);
    }

    public static boolean allGreaterThanZero(Number... numbers) {
        if (CollectionUtil.isEmpty(numbers)) {
            return false;
        }
        for (Number num : numbers) {
            if (!isGreaterThanZero(num)) {
                return false;
            }
        }
        return true;
    }

    public static Long parseLong(Object number) {
        return parseLong(number, null);
    }

    public static Long parseLong(Object number, Long defaultValue) {
        Number num = StringUtil.getNumber(number);
        if(num != null) {
            return num.longValue();
        }
        return defaultValue;
    }

}
